#ifndef __MCS__TYPE_MISMATCH_EXCEPTION__HPP
#define __MCS__TYPE_MISMATCH_EXCEPTION__HPP

#include "CompileException.hpp"
#include "Value.hpp"

class TypeMismatchExcepion : public CompileException
{
public:
	TypeMismatchExcepion(Value::DataType presentType, Value::DataType desiredType, SourceLocation const & location)
		: CompileException(location)
		, presentType_(presentType)
		, desiredType_(desiredType)
	{}

	Value::DataType presentType() const { return presentType_; }
	Value::DataType desiredType() const { return desiredType_; }

	virtual std::ostream & stream(std::ostream & str) const
	{
		return CompileException::stream(str) << "expression of type \"" << desiredType_ << "\" expected instead of \"" << presentType_ << "\"";
	}
private:
	Value::DataType presentType_;
	Value::DataType desiredType_;
};

#endif //__MCS__TYPE_MISMATCH_EXCEPTION__HPP
